home *** CD-ROM | disk | FTP | other *** search
/ Mastering Web Site Development / Microsoft Mastering Web Site Development (Microsoft) (1997).iso / Labs / Lab09 / transfer.cls < prev    next >
Encoding:
Visual Basic class definition  |  1997-04-24  |  1007 b   |  42 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Obj"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Public Function Transfer(ByVal lngStudentID As Long, ByVal strSrcClassID As String, ByVal strDstClassID As String) As Integer
  11.     Dim ctxObject As ObjectContext
  12.     Dim addobj As Add.Obj
  13.     Dim dropobj As Drop.Obj
  14.     Dim errResult As Integer
  15.  
  16.     On Error GoTo ErrorHandler
  17.  
  18.     
  19.     ' Get the object's ObjectContext.
  20.  
  21.  
  22.     'Create Add and Drop objects using the Context Object
  23.  
  24.     errResult = addobj.Add(lngStudentID, strDstClassID)
  25.  
  26.     'Check for error
  27.     If errResult = 1 Then Transfer = 1
  28.     errResult = dropobj.Drop(lngStudentID, strSrcClassID)
  29.     
  30.     'Check for error
  31.     If errResult = 1 Then Transfer = 1
  32.  
  33.     'Work completed successfully
  34.  
  35.     Exit Function
  36.     
  37. ErrorHandler:
  38.     'Abort if any errors occurred
  39.     Transfer = 1
  40.  
  41. End Function
  42.